package cn.dto;

import java.io.IOException;
import java.io.InputStream;
/**
 * 处理接受客户端通过post方式提交的JSON数据
 * @author Administrator
 *
 */
public class common {
	public static String getPostData(InputStream in, int size, String charset) {
        if (in != null && size > 0) {
            byte[] buf = new byte[size];
            try {
                in.read(buf);
                if (charset == null || charset.length() == 0)
                    return new String(buf);
                else {
                    return new String(buf, charset);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    } 
}
